/**
 * Sensor Network Development Kit for 1-Wire Network (SeN)
 * Version : 0.1
 * Revision date : 2008-10-13
 * Author: Dubravko Penezic, dpenezic@gmail.com
 * 
 */

package utilityLib;

/**
 * TemperatureTransformer class implement method to transform temperature from one scale to another
 * Version : 0.1.1
 * Revision date : 2008-10-20
 * 
 * @author Dubravko Penezic, dpenezic@gmail.com
 *
 */

public class TemperatureTransformer {
	
	public TemperatureTransformer(){
		
	}

/**
 * fromCtoF method transform temperature from C to F
 * 
 * @param temp
 * @return
 */
	public double fromCtoF(double temp){
		
		return temp * 9.0d/5.0d + 32d;
		
	}

/**
 * fromCtoK method transform temperature from C to K
 * 
 * @param temp
 * @return
 */
	public double fromCtoK(double temp){
		
		return temp + 273.15d;
		
	}

/**
 * fromFtoC method transform temperature from F to C
 * 
 * @param temp
 * @return
 */
	public double fromFtoC(double temp){
		
		return (temp - 32d)* 5.0d/9.0d;
	
	}

/**
 * fromFtoK method transform temperature from F to K
 * 
 * @param temp
 * @return
 */
	public double fromFtoK(double temp){
		
		return this.fromCtoK(this.fromFtoC(temp));
		
	}

/**
 * fromKtoC method transform temperature from K to C
 * 
 * @param temp
 * @return
 */
	public double fromKtoC(double temp){
		
		return temp - 273.15d;
		
	}

/**
 * fromKtoF method transform temperature from K to F
 * @param temp
 * @return
 */
	public double fromKtoF(double temp){
		
		return this.fromCtoF(this.fromKtoC(temp));
		
	}
}
